Declare Function DlgDirList Lib "User" (ByVal hDlg As Integer, ByVal lpPathSpec As String, ByVal nIDListBox As Integer, ByVal nIDStaticPath As Integer, ByVal wFiletype As Integer) As Integer
Declare Function DlgDirSelect Lib "User" (ByVal hDlg As Integer, ByVal lpString As String, ByVal nIDListBox As Integer) As Integer
Declare Function SetErrorMode Lib "Kernel" (ByVal wMode As Integer) As Integer
' IDs of the controls we'll be needing
Const IDS_PATH = 3
Const IDL_FLIST = 7
Const IDL_DLIST = 8
' search spec
Const sFileSpec = "*.*"
' last change flags
Const FListBox = 1
Const DListBox = 2
' iChange holds the last change flag
Dim iChange As Integer
' sCurDir holds the most recent directory
Dim sCurDir As String
Sub DList_Click ()
iChange = DListBox
End Sub
Sub DList_DblClick ()
' Prepare a buffer to hold the new directory
aDir$ = String$(15, 0)
' get the new directory
Ok = DlgDirSelect(IDOPEN.hWnd, aDir$, IDL_DLIST)
' get rid off the Chr$(0)s
aDir$ = Left$(aDir$, InStr(aDir$, Chr$(0)) - 1)
' let Windows handle the errors, e.g. drive not ready, etc
iErrMode = SetErrorMode(0)
' perform the changes
Ok = DlgDirList(IDOPEN.hWnd, (aDir$ + sFileSpec), IDL_FLIST, IDS_PATH, 0)
Ok = DlgDirList(IDOPEN.hWnd, "*.*", IDL_DLIST, 0, &HC010)
' give error control back to us
iErrMode = SetErrorMode(1)
' save the directory change
sCurDir = LCase$(MakePath$(CurDir$))
End Sub
Sub FList_Click ()
iChange = FListBox
End Sub
Sub FList_DBlClick ()
' if there is a selection, retrieve it and change the IDDEMO